{extend name="index/public" /}

{block name="content"}
<form class="layui-form" action="" id="searchBox">
    <div class="layui-inline">
        <input type="text" name="my_user_id" value="" id="my_user_id" placeholder="用户ID/登录名称" autocomplete="off" class="layui-input">
    </div>
    <div class="layui-inline">
        <input type="text" name="role_id" value="" id="role_id" placeholder="角色ID/角色名称" autocomplete="off" class="layui-input">
    </div>
    <div class="layui-inline">
        <input type="text" name="server_id" value="" id="server_id" placeholder="区服ID/区服名称" autocomplete="off" class="layui-input">
    </div>
    <div class="layui-inline">
        <input type="text" name="my_order_id" value="" id="my_order_id" placeholder="米娱订单号" autocomplete="off" class="layui-input">
    </div>
    <div class="layui-inline">
        <div class="layui-input-inline">
            {MyTag:channel type='manage' /}
        </div>
    </div>
    <div class="layui-inline">
        <div class="layui-input-inline">
            {MyTag:game type='manage' /}
        </div>
    </div>
    <div class="layui-inline">
        <a href="javascript:;" class="layui-btn searchBtn my-btn my-btn-sm">搜索</a>
    </div>
</form>

<table id="tableBox" lay-filter="tableBox"></table>

{/block}

{block name="css"}
{/block}

{block name="js"}
<script>
    layui.use('table', function(){
        var table = layui.table
            ,$ = layui.$
            ,form = layui.form
            ,load = null
            ,active = {
                reload: function () {
                    var jsonObj = {
                        "my_user_id": $('#my_user_id').val()
                        ,"role_id": $('#role_id').val()
                        ,"server_id": $('#server_id').val()
                        ,"my_order_id": $('#my_order_id').val()
                        ,"game_id": $('#game_id').val()
                        ,"channel_id": $('#channel_id').val()
                    };
                    table.reload('tableId', {
                        page: {curr: 1}
                        ,where: jsonObj
                        ,height: 'full-100'
                    })
                },
            };

        //表格初始化
        table.render({
            elem: '#tableBox'
            ,height: 'full-100'
            ,url: '{:url("RebateOrder/index")}'
            ,page: true
            ,limit:20
            ,limits:[20,40,60,80]
            ,loading:true
            ,id:'tableId'
            ,done: function (res, curr, count) {
                layer.close(load);
                $('#layui-loading').hide();
            }
            ,cols: [[
                {field:'apply_id', title: '返利ID', width: 70}
                ,{field:'rule', title: '返利规则', width: 180}
                ,{field:'rebate_game_coin', title: '返游戏币', width: 90}
                ,{field:'apply_time', title: '申请时间', width: 130}
                ,{field:'my_order_id', title: '米娱订单号', width: 165}
                ,{field:'channel_id', title: '渠道名称', width: 120}
                ,{field:'game_id', title: '游戏名称', width: 120}
                ,{field:'my_user_id', title: '登录名称', width: 130}
                ,{field:'role_id', title: '角色名称', width: 220}
                ,{field:'server_id', title: '区服名称', width: 130}
                ,{field:'total_price', title: '充值金额', width: 90}
                ,{field:'game_coin', title: '充游戏币', width: 90}
                ,{field:'pay_time', title: '支付时间', width: 130}
            ]]
        });

        $('#searchBox .searchBtn').on('click', function(){
            load = layer.load();
            active['reload'].call(this);
            return false;
        });
    });
</script>
{/block}